home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.3 Development Libraries / SGI IRIX 6.3 Development Libraries.iso / dist6.3 / ViewKit_dev.idb / usr / include / Vk / VkSimpleWindow.h.z / VkSimpleWindow.h
Encoding:
C/C++ Source or Header  |  1996-09-20  |  7.2 KB  |  200 lines

  1. ////////////////////////////////////////////////////////////////////////////////
  2. ///////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
  3. //                                                                            //
  4. // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;     //
  5. // the contents of this file may not be disclosed to third parties, copied    //
  6. // or duplicated in any form, in whole or in part, without the prior written  //
  7. // permission of Silicon Graphics, Inc.                                       //
  8. //                                                                            //
  9. // RESTRICTED RIGHTS LEGEND:                                                  //
  10. // Use,duplication or disclosure by the Government is subject to restrictions //
  11. // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data     //
  12. // and Computer Software clause at DFARS 252.227-7013, and/or in similar or   //
  13. // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -    //
  14. // rights reserved under the Copyright Laws of the United States.             //
  15. //                                                                            //
  16. ////////////////////////////////////////////////////////////////////////////////
  17.  
  18. #ifndef VKSIMPLEWINDOW_H
  19. #define VKSIMPLEWINDOW_H
  20.  
  21. // VkSimpleWindow.h - declarations for a Motif toplevel window object
  22.  
  23. class VkApp;
  24.  
  25. #include <Vk/VkComponent.h>
  26.  
  27. ////////////////////////////////////////////////////////////////////////////////
  28. //
  29. // NOTE: Quick Help is new in the IRIX 6.2 release.  There are two forms of
  30. //       access:
  31. //        * Resource-based access is documented in the man page and
  32. //          is fully supported.  Go ahead and set your resources.  For
  33. //          most programs, this is all the access they will ever need.
  34. //
  35. //        * The programmatic access to Quick Help is still experimental.
  36. //          in IRIX 6.2.
  37. //
  38. //            IT MAY CHANGE IN THE NEXT RELEASE.
  39. //
  40. //          That is why it is not documented in the man pages.  For
  41. //          an example of current use, see the QuickHelp demo program.
  42. //
  43. ////////////////////////////////////////////////////////////////////////////////
  44.  
  45. // Some constants to go along with the Quick Help calls
  46.     enum VkDisplayWhere {VkNEAR_POINTER=-1, VkNEAR_WIDGET=-2};
  47.     enum VkKeep         {VkKEEP, VkRESOURCE};
  48.     enum VkWhichHelp    {VkMESSAGE_LINE_HELP, VkPOPUP_HELP, VkBOTH_HELP};
  49.  
  50. //Quick Help callData structures
  51.     typedef struct {
  52.     Boolean libDisplay;    // If TRUE, library also posts help
  53.     Widget widget;        // Widget that got the enter
  54.     XmString msg;        // Help string the library has
  55.     int x, y;        // Position the library has for popup
  56.     } quickHelpEnterCallbackStruct;
  57.  
  58.     typedef struct {
  59.     Boolean libDisplay;    // If TRUE, library also clears help
  60.     Widget widget;        // Widget that got the leave
  61.     } quickHelpLeaveCallbackStruct;
  62.  
  63.  
  64. class VkSimpleWindow : public VkComponent {
  65.  
  66.     friend class VkApp;
  67.     friend class VkQuickHelp;
  68.  
  69.   public:
  70.  
  71.     VkSimpleWindow(const char *name, ArgList argList = NULL, Cardinal argCount = NULL);    
  72.     virtual ~VkSimpleWindow();
  73.  
  74.     void addView(Widget);
  75.     void addView(VkComponent *);
  76.  
  77.     void removeView();
  78.  
  79.     virtual void open();
  80.     virtual void raise();
  81.     virtual void lower();
  82.     virtual void iconize();  // obsolete
  83.     virtual void iconify();
  84.     virtual void show();
  85.     virtual void hide();
  86.  
  87.     virtual void build();   // obsolete, don't use directly
  88.  
  89.     const char *getTitle();
  90.     void setTitle(const char *);
  91.     void setIconName(const char *);
  92.     void setClassHint(const char *className);
  93.  
  94.     virtual const char* className();
  95.     Boolean iconic() const { return (_iconState == CLOSED); }
  96.     Boolean visible() const { return (_visibleState == VISIBLE); }
  97.     virtual Widget     mainWindowWidget() const;
  98.     virtual Widget     viewWidget() const;
  99.     virtual operator Widget () const;
  100.  
  101.     void setWindowSizes(int minWidth, int minHeight,
  102.             int maxWidth, int maxHeight);
  103.     
  104.     static VkSimpleWindow *getWindow(VkComponent *);
  105.  
  106.     // NOTE: as stated at the top of this file, programmatic access to
  107.     //       Quick Help is experimental in IRIX 6.2, and may change in a
  108.     //         later release.  Use at  your own risk.
  109.     // 
  110.     // Quick Help entry points.
  111.  
  112.     // Immediate display of quick help.
  113.     // This allows for a geat deal of control -- the application can
  114.     // fall back on this if the library is not doing what it needs.
  115.        void displayHelpString (char *msgLine=NULL, char *popup=NULL,
  116.                   int x=(int)VkNEAR_POINTER, int y=0,
  117.                   Boolean delay=FALSE);
  118.        void displayHelpResource (Widget w,
  119.                   char *msgLine=NULL, char *popup=NULL,
  120.                   VkWhichHelp which=VkBOTH_HELP,
  121.                   int x=(int)VkNEAR_WIDGET, int y=0,
  122.                   Boolean delay=FALSE);
  123.        void unDisplayHelp (Widget w=NULL);
  124.  
  125.     // Update part of VkSimpleWindow's widget tree.  NULL => entire tree.
  126.        void quickHelpUpdate(Widget w=NULL);
  127.  
  128.     // Set the times for balloon help.  Any parameter that is -1 is
  129.     // ignored.  This allows you te change just some of the times.
  130.     //
  131.     // NOTE: we do not want to include VkQuickHelp.h, because it is not
  132.     //     public.  These default times need to be kept in sync with
  133.     //     those in VkQuickHelp.c++ by hand.
  134.        void setPopupTime (int initialDelay=800, int upTime=3000,
  135.                  int browseWaitTime=100, int browseVelocity=10,
  136.                  int browseCancelTime=500);
  137.  
  138.     // Get the current popup times
  139.        void VkSimpleWindow::getPopupTime (int *initial, int *stayUp,
  140.                 int *bInit, int *bVelocity, int *bCancel);
  141.  
  142.     // Override the default (resource) help strings
  143.        void setQuickHelp (Widget w, char *msgLine=NULL,
  144.                   char *popup=NULL, VkKeep which=VkRESOURCE);
  145.     // Quick Help callback names
  146.        static const char *const hideMsgLineCallback;
  147.        static const char *const showMsgLineCallback;
  148.        static const char *const hidePopupCallback;
  149.        static const char *const showPopupCallback;
  150.     
  151.   protected:
  152.  
  153.     enum IconState     { OPEN, CLOSED, ICON_UNKNOWN        };
  154.     enum VisibleState  { HIDDEN, VISIBLE, VISIBLE_UNKNOWN  };
  155.     enum StackingState { RAISED, LOWERED, STACKING_UNKNOWN };
  156.  
  157.     IconState      _iconState;
  158.     VisibleState   _visibleState;
  159.     StackingState  _stackingState;
  160.     Widget         _mainWindowWidget;
  161.  
  162.     Boolean        _usingSetUpInterface; 
  163.     virtual Widget setUpInterface(Widget );
  164.  
  165.     virtual void setUpWindowProperties();
  166.     virtual void stateChanged(IconState);
  167.     virtual void handleWmDeleteMessage();
  168.     virtual void handleWmQuitMessage();    
  169.     virtual void handleRawEvent(XEvent *event);
  170.     virtual void afterRealizeHook();
  171.  
  172.     virtual void busy();
  173.     virtual void veryBusy();
  174.     virtual void notBusy();
  175.  
  176.   private:
  177.  
  178.         Boolean handleRawHelpEvent(XEvent *event, Widget);
  179.     static  void stateChangedEventHandler(Widget, XtPointer, XEvent *, Boolean *);
  180.     static  void deleteWindowCallback(Widget, XtPointer, XtPointer);
  181.     static  void quitAppCallback(Widget, XtPointer, XtPointer);
  182.  
  183.     static Boolean setupHelpCallback(XtPointer);
  184.  
  185.     Widget     _viewWidget;
  186.     Window     _busyWindow;
  187.     Boolean    _busy;
  188. };
  189.  
  190. extern void VkConfigureWM(VkSimpleWindow *w,
  191.               Boolean quit    = TRUE,
  192.               Boolean close   = TRUE,
  193.               Boolean border  = TRUE,
  194.               Boolean title   = TRUE,
  195.               Boolean resize  = TRUE,
  196.               Boolean iconify = TRUE,
  197.               Boolean menu    = TRUE);
  198.  
  199. #endif
  200.